package cc.forgemod.customicon.client;

import cc.forgemod.customicon.client.command.ClientCommand;
import cc.forgemod.customicon.client.renderer.RenderListener;
import cc.forgemod.customicon.common.ConfigItems;
import cc.forgemod.customicon.common.IProxy;
import cc.forgemod.customicon.common.util.CacheUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.command.ICommandSender;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy implements IProxy {

    @Override
    public void preInit(FMLPreInitializationEvent pEvent) {
        CacheUtils.loadCacheIcons();

        MinecraftForge.EVENT_BUS.register(ResourceListener.INSTANCE);
        MinecraftForge.EVENT_BUS.register(RenderListener.INSTANCE);

        ClientCommandHandler.instance.registerCommand(new ClientCommand());
    }

    @Override
    public void init(FMLInitializationEvent pEvent) {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ConfigItems.mCItem, ResourceListener.INSTANCE);
    }

    @Override
    public void reloadConfig(ICommandSender pSender) {}

}
